package com.googlecode.lookie.imagedb.internal;

import java.util.HashMap;
import java.util.Map;

import com.googlecode.lookie.imagedb.ImageDao;
import com.googlecode.lookie.imagedb.ImageData;

public class InMemoryImageDao
    implements ImageDao
{

    private Map<String, ImageData> dataMap = new HashMap<String, ImageData>();

    private Map<String, byte[]> imageMap = new HashMap<String, byte[]>();

    public void delete( String id )
    {
        dataMap.remove( id );
        imageMap.remove( id );
    }

    public ImageData getImageData( String id )
    {
        return dataMap.get( id );
    }

    public void insert( ImageData data, byte[] bs )
    {
        dataMap.put( data.getId(), data );
        imageMap.put( data.getId(), bs );
    }

    public void update( ImageData data, byte[] bs )
    {
        insert( data, bs );
    }

    public byte[] getImage( String id )
    {
        // TODO Auto-generated method stub
        return null;
    }

}
